package com.example.test.advice.第三章_类_对象_方法.建议49_推荐覆写toString方法;

import org.apache.commons.lang3.builder.ToStringBuilder;

public class ToStringClient {

    public static void main(String[] args) {

        System.out.println(new Person("张三"));

    }
}

class Person{

    private String name;

    public Person(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this).append("name",name).toString();
    }
}